package edums.student.dao;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.SqlMapClientTemplate;

import edums.employee.dto.LectureDTO;
import edums.student.dto.StudentAttendanceDTO;

public class StudentAttendanceDAOImpl implements StudentAttendanceDAO {
	
	private SqlMapClientTemplate client;
	
	public StudentAttendanceDAOImpl(SqlMapClientTemplate client){
		this.client = client;
	}
	
	@Override
	public List seleactLectureList(Map searchInfo) throws SQLException {
		return client.queryForList("studentAttendance.selectLectureList", searchInfo);
	}

	@Override
	public int selectLectureListTotalContent(Map searchInfo)
			throws SQLException {
		return (Integer) client.queryForObject("studentAttendance.selectLectureListTotalContent", searchInfo);
	}

	@Override
	public void insertStudentAttendance(StudentAttendanceDTO sadto)
			throws SQLException {
		client.insert("studentAttendance.insertStudentAttendance", sadto);
	}
	
	@Override
	public void updateStudentAttendance(Map studentAttendanceInfo)
			throws SQLException {
		client.update("studentAttendance.updateStudentAttendance", studentAttendanceInfo);
	}

	@Override
	public LectureDTO selectLecture(String lectureId) throws SQLException{
		return (LectureDTO) client.queryForObject("studentAttendance.selectLecture", lectureId);
	}

	@Override
	public List selectAllStudentAttendance(Map studentAttendanceInfo) throws SQLException {
		return (ArrayList) client.queryForList("studentAttendance.selectAllStudentAttendance", studentAttendanceInfo);
	}
	
	@Override
	public List selectStudentAttendanceDateYear(Map studentAttendanceInfo)
			throws SQLException {
		return client.queryForList("studentAttendance.selectStudentAttendanceDateYear", studentAttendanceInfo);
	}

	@Override
	public List selectStudentAttendanceDateMonth(Map studentAttendanceInfo)
			throws SQLException {
		return client.queryForList("studentAttendance.selectStudentAttendanceDateMonth", studentAttendanceInfo);
	}

	@Override
	public int selectStudentAttendanceTotalContent(Map studentAttendanceInfo)
			throws SQLException {
		return (Integer) client.queryForObject("studentAttendance.selectStudentAttendanceTotalContent", studentAttendanceInfo);
	}

	@Override
	public StudentAttendanceDTO selectStudentAttendance(Map studentAttendanceInfo) throws SQLException {
		return (StudentAttendanceDTO) client.queryForObject("studentAttendance.selectStudentAttendance", studentAttendanceInfo);
	}

	@Override
	public Map selectLectureTime(Map searchInfo) throws SQLException {
		return (HashMap) client.queryForObject("studentAttendance.selectLectureTime", searchInfo);
	}
	
}
